import {EventEmitter, Injectable} from '@angular/core';
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
@Injectable()
export class S1Service {
  //父组件传递给子组件(嵌套关系)
  change: EventEmitter<any>;
  //没有嵌套关系的组件传递数据
  send: BehaviorSubject<any> = new BehaviorSubject('');
  currentSend = this.send.asObservable();
  constructor() {
    this.change = new EventEmitter<any>();
  }
  sendMsg(msg: string) {
    this.send.next(msg);
  }
}
